import redis

class Config(object):
    '''配置信息'''

    SECRET_KEY = "XADFHADSLFJAODI"

    # 数据库
    # sqlalchemy的配置参数
    SQLALCHEMY_DATABASE_URI = "postgresql://root:123456@172.20.100.8/ihome_python04"

    # 开启自动提交选项
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True

    # 数据库跟踪修改，默认关闭
    SQLALCHEMY_TRACK_MODIFICATION = True
    SQLALCHEMY_TRACK_MODIFICATIONS = True

    # redis
    REDIS_HOST="172.20.100.8"
    REDIS_PORT=6379

    # flask-session配置
    SESSION_TYPE="redis"
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    SESSION_USE_SIGNER=True # 对cookie中session_id进行隐藏
    PERMANENT_SESSION_LIFETIME=86400 # session数据的有效期,单位:秒

    #腾讯短信相关
    TENCENT_SECRET_ID = "AKIDSmvpVw73kCOL3WkkV0GH3ZqtgDVYOzLT"
    TENCENT_SECRET_KEY = "wd4GDvNaYHl24rPimbBVaR6WgbHhrlQp"
    TENCENT_CITY = "ap-guangzhou"  # 地域
    TENCENT_APP_ID = "1400586803"
    TENCENT_SIGN = "健哥程序之路"

class DevelopmentConfig(Config):
    '''开发模式的配置信息'''
    DEBUG = True

class ProductionConfig(Config):
    '''生产环境配置信息'''
    pass

# 构建名字与类的对应关系
config_map={
    "develop":DevelopmentConfig,
    "product":ProductionConfig
}
